﻿@model JuCheap.Core.Models.ViewModels.PaiBanViewModel
@{
    ViewData["Title"] = "Add";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}



<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>排班设置</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <form asp-controller="PaiBan" asp-action="EditWorkerPaiBan" class="form-horizontal" method="POST">
                <div class="form-group">

                    <label class="col-sm-3 control-label" asp-for="WorkerId">员工姓名</label>
                    <div class="col-sm-8">

                        <input type='text' name="workerName" asp-for="Worker.Name" readonly="readonly" class="form-control" />
                        <input type='hidden' id="WorkerId" name="WorkerId" asp-for="Worker.Id" />
                        <input type='hidden' id="Id" name="Id" asp-for="Id" />
                        <span asp-validation-for="WorkerId"></span>
                    </div>

                </div>



                @*<div class="form-group">
                        <label class="col-sm-3 control-label" asp-for="WorkerId"></label>
                        <div class="col-sm-8">
                            <select id="WorkerId" name="WorkerId" asp-for="WorkerId" class="form-control"></select>
                            <span asp-validation-for="WorkerId"></span>
                        </div>
                    </div>*@
                <div class="form-group">
                    <label class="col-sm-3 control-label">班次</label>
                    <div class="col-sm-8">
                        <select id="BanCiId" name="BanCiId" asp-for="BanCiId" class="form-control"></select>
                        <span asp-validation-for="BanCiId"></span>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label">排班日期</label>
                    <div class="col-sm-3">
                        <div class='input-group date' id='Start'>
                            <input type='text' asp-for="DateStart" name="DateStart" class="form-control" />
                            <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>
                        <div class='input-group date' id='End'>
                            <input type='text'  asp-for="DateEnd"  name="DateEnd" class="form-control" />
                            <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>

                    </div>

                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btn btn-info" type="submit">保存</button>
                        <button class="btn btn-white" type="button" id="btnBack">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
@section styles{
    <link href="~/css/bootstrap.min.css" rel="stylesheet">
    <link href="~/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="~/js/plugins/select2/css/select2.css" rel="stylesheet" />
}

@section scripts{
    <script src="~/js/plugins/jqgrid/jquery.jqGrid.js"></script>
    <script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js"></script>
    <script src="~/js/jqgrid-list.js"></script>
    <script src="~/js/json2.js"></script>
    <script src="~/js/base.js"></script>
    <script src="~/js/moment.js"></script>
    <script src="~/js/bootstrap-datetimepicker.min.js"></script>
    <environment names="Staging,Production">
        <script src="~/js/grid.min.js" asp-append-version="true"></script>
        <script src="~/js/validate.min.js" asp-append-version="true"></script>
        <script src="~/js/base.min.js" asp-append-version="true"></script>
    </environment>
    <script src="~/js/plugins/select2/js/select2.js"></script>
    <script src="~/js/BindSelect.js"></script>
    <script>
        $(function () {
            $('#Start').datetimepicker({
                format: 'YYYY-MM-DD',
                locale: moment.locale('zh-cn')
            });
            $('#End').datetimepicker({
                format: 'YYYY-MM-DD',
                locale: moment.locale('zh-cn')
            });
        });
        $("#btnBack").bind("click", function (e) {
            XPage.GoTo(e.target, "@Url.Action("Index")");
        });

        $("#Company").change(function () {

            $("#CompanyId").val($("#Company").val());
        });
        $(function () {
            //BindSelectByValue("WorkerId", "/Worker/GetWorkers", @Model.Worker.Id);

            BindSelectByValue("BanCiId", "/BanCi/GetBanCi", @Model.BanCiId);
            //$("#WorkerId").attr("disabled", "disabled");
        });

    </script>
}
